﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonClasses.Utility;

namespace CommandGraph.Model
{
    public static class Algorithms
    {
        public static bool CanPass(ForkAndJoin from, ForkAndJoin to)
        {
            var canPass = from == to;

            if (!canPass)
                foreach (var trans in from.OutcomingThreads)
                    if (trans.Ending != null)
                        if (trans.Ending.Parent is ForkAndJoin) //для LoopBody
                            canPass |= CanPass(trans.Ending.Parent as ForkAndJoin, to);

            return canPass;
        }
    }
}